package com.cdivtc.management;

import com.cdivtc.management.shiro.JwtToken;
import com.cdivtc.management.utils.JwtUtil;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;

public class CredentialMatcher extends SimpleCredentialsMatcher {
//    密码检验规则
    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
        JwtToken jwtToken = (JwtToken) token;

        return JwtUtil.verify((String) jwtToken.getPrincipal().toString());
    }
}
